package com.niuwa.p2p.service.impl.message;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.niuwa.p2p.core.utils.AppConstants;
import com.niuwa.p2p.dao.dictionary.DictionaryDao;
import com.niuwa.p2p.dao.message.MessageDao;
import com.niuwa.p2p.entity.Dictionary;
import com.niuwa.p2p.entity.message.Message;
import com.niuwa.p2p.service.message.IMessageService;
import com.niuwa.p2p.vo.front.account.MsgVo;

@Service
public class MessageServiceImpl implements IMessageService{
	
	@Autowired
	private MessageDao messageDao;
	
	@Autowired
	private DictionaryDao dictionaryDao;
	
	@Override
	public List<MsgVo> selectMsgBySelectiveListPage(
			Map<String, Object> paramMap) {
		return messageDao.selectMsgBySelectiveListPage(paramMap);
	}

	@Override
	public long selectUnreadMsgCount(Map<String, Object> paramMap) {
		return messageDao.selectUnreadMsgCount(paramMap);
	}

	@Override
	public int updateMsgReadStatus(Map<String,Object> paramMap) {
		return messageDao.updateMsgReadStatus(paramMap);
	}

	@Override
	public List<Message> getMessageList(Map<String, Object> paramMap) {
		return messageDao.getMessageList(paramMap);
	}

	@Override
	public int getMessageListCount(Map<String, Object> paramMap) {
		return messageDao.getMessageListCount(paramMap);
	}

	@Override
	public Message getMessageById(Long id) {
		
		return messageDao.selectByPrimaryKey(id);
	}

	@Override
	public Map<String, List<Dictionary>> getMessageDict() throws Exception {
		Map<String, List<Dictionary>> map=new HashMap<String, List<Dictionary>>();
		//消息大类
		List<Dictionary> msgDict=dictionaryDao.getDictByDictType(AppConstants.MSG_KIND);
		map.put("msgDict", msgDict);
		return map;
	}

	@Override
	public Message selectMessageBySelective(Map<String, Object> map) {
		return messageDao.selectMessageBySelective(map);
	}

	@Override
	public int updateMsgValid(Map<String, Object> map) throws Exception{
		return messageDao.updateMsgValid(map);
	}

	
}
